#include <linux/module.h>
#include <linux/kernel.h>
#include "ei_os.h"

extern int __init os_mem_init(void);
extern void __exit os_mem_exit(void);
extern void os_device_init(void);
extern void os_device_exit(void);

extern void os_proc_init(void);
extern void os_proc_exit(void);

extern int eimedia_bus_init(void);
extern void eimedia_bus_exit(void);

extern int eimedia_device_init(void);
extern void eimedia_device_exit(void);

extern int os_log_init(void);
extern int os_log_exit(void);


static int __init os_init(void)
{
	int ret = 0;

	printk("osal %s init success!\n", LB_OSAL_VERSION);

	os_device_init();
	os_proc_init();
	ret = eimedia_bus_init();
	if (ret)
		goto err0;

	ret = eimedia_device_init();
	if (ret)
		goto err1;

	ret = os_mem_init();
	if (ret)
		goto err2;

	return 0;

err2:
	eimedia_device_exit();
err1:
	eimedia_bus_exit();
err0:
	os_proc_exit();
	os_device_exit();

	return ret;
}

static void __exit os_exit(void)
{
	os_mem_exit();

	eimedia_device_exit();
	eimedia_bus_exit();

	os_proc_exit();
	os_device_exit();

	printk("osal %s exit!\n", LB_OSAL_VERSION);
}

module_init(os_init);
module_exit(os_exit);

MODULE_AUTHOR("EISW");
MODULE_LICENSE("GPL");
MODULE_VERSION("1.0");
